fix(spector): prevent unauthenticated remote server stop#11274
Merged
Conversation
Bind the mock server to the loopback interface (127.0.0.1) by default and reject /.admin/stop requests from non-loopback sources. Adds a --host option to opt into binding on all interfaces (e.g. 0.0.0.0 inside a container).
commit: |
|
You can try these changes here
|
timotheeguerin
marked this pull request as ready for review
July 16, 2026 17:05
timotheeguerin
requested review from
bterlson,
catalinaperalta,
iscai-msft,
markcowl and
witemple-msft
as code owners
July 16, 2026 17:05
The mock server now always binds to 127.0.0.1, so the unauthenticated /.admin/stop endpoint is unreachable from other hosts. This removes the need for the --host option and the per-request loopback check.
timotheeguerin
enabled auto-merge (squash)
July 16, 2026 21:56
catalinaperalta
approved these changes
Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Hotfix for a reported unauthenticated remote stop vulnerability in
@typespec/spector.The mock server registered
POST /.admin/stopwith no authentication and bound to all interfaces (0.0.0.0) by default, so any network-reachable client could terminate the server process with a single request.Fix
The mock server is only ever used locally, so it now always binds to the loopback interface (
127.0.0.1). This makes the admin/stop endpoint unreachable from other hosts, which fully closes the reported vector without needing any per-request origin/host check.Notes
fetchthat clients still connect overlocalhosteven on IPv6-first (localhost->::1) resolution, so existing localhost-based test workflows keep working.tsp-spector server stop(which posts tohttp://localhost:<port>/.admin/stop) continues to work unchanged.fix).